#include "NetVersion.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>


extern int g_nCapture;

static const char* month[] = {
    "Jan", "Feb", "Mar", "Apr", "May", "Jun", 
    "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
};



void Net_Version_GetBuildDate(Net_SYSTEM_TIME *pTime)
{
	int i, year, day;
    char s1[] = __DATE__;
    char s2[] = __TIME__;
    char *p;
	for (i = 0; i < 12; i++) {
        if( strncmp(month[i], s1, 3) == 0 )
            break;
    }
	pTime->month = i+1;    
    p = s1; p += 4;
    if ( *p == ' ') {
        *p = '0';
    }
    sscanf(p, "%d %d", &day, &year);
    pTime->day    = day;
    pTime->year = year;
    pTime->hour = atoi(s2);
    pTime->minute = atoi(s2 + 3);
    pTime->second = atoi(s2 + 6);
}



void Net_GetSysAttrEx(SYSATTR_EX_T* psys_attr)
{
	psys_attr->iVideoInCaps = g_nCapture;
	psys_attr->iVideoOutCaps = 1;

	/*if (g_CapsEx.HasAudioBoard)
	{
		// 特殊的设备，音频输入数量不能用视频通道来表示，两者不一样
		#ifdef ENC_SPECIAL_AUDIO_CHANNELS
		psys_attr->iAudioInCaps = g_CapsEx.HasAudioBoard;
		#else
		psys_attr->iAudioInCaps = g_nCapture;
		#endif
	}else{*/
	psys_attr->iAudioInCaps = 0;  //展示写0
	//}
	psys_attr->iAudioOutCaps = g_nCapture;//与拿来写1

	psys_attr->iAlarmInCaps = 0;//g_nAlarmIn;
	psys_attr->iAlarmOutCaps = 0;//g_nAlarmOut; 暂时写0
	psys_attr->iDiskNum = 4;
	psys_attr->iAetherNetPortNum = 0x01;

	psys_attr->iUsbPortNum = 2;
	psys_attr->iDecodeChanNum = 1;//暂时写1  hyd 20161107
	psys_attr->iComPortNum = 0x01;
	psys_attr->iParallelPortNum = 0;

	psys_attr->iSpeechInCaps = 0;
	psys_attr->iSpeechOutCaps = 0;
}

void Net_FormatTimeString(Net_SYSTEM_TIME *p,char* buf,int flag)
{

	char spector='.';
	int hour = p->hour;
	sprintf(buf,"%04d%c%02d%c%02d %02d:%02d:%02d",p->year,spector,p->month,spector,p->day,hour,p->minute,p->second);
	//if(flag&FT_NO_SECOND){
	//	buf[strlen(buf)-3] = '\0';
	//}

}


bool Net_GetUserAuth(USER_AUTH_LIST* user_auth)//没有接口，先写死
{

	user_auth->uiControlConfigMask=4194303;
	user_auth->uiMonitorMask=0;
	user_auth->uiNetPreviewMask=0;
	user_auth->uiPlayMask=0;
	user_auth->uiReserved[0]=0;
	user_auth->uiReserved[1]=0;
	user_auth->uiReserved[2]=0;
	user_auth->uiReserved[3]=0;
    return true;
}








